/*
 * @Author: your name
 * @Date: 2020-09-16 17:17:05
 * @LastEditTime: 2020-09-16 17:35:51
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \blockchain\src\utils\tool\getQuery.js
 */
// 截取地址携带参数


export default{
   getQuery (param) {
    // 若为单页面hash模式，则通过hash获取参数
    const {search, hash} = location
    const href = search.substr(1) || hash.slice(hash.indexOf('?') + 1)
    let obj = {}
    href.split('&').forEach(i => {
      const item = i.split('=')
      obj[item[0]] = decodeURIComponent(item[1])
    })
    return param ? obj[param] : obj
  }
}
